<template>
  <Card style="margin-bottom:25px;">
    <p slot="title">
      创建会议室
    </p>
    <add-from ref="addFrom" :equipData="equipData" @on-success-valid="handleSubmit"></add-from>
  </Card>
</template>

<script>
import { addMeetRoom } from '@/api/meet'
import AddFrom from './add/addFrm.vue'

export default {
  data () {
    return {
      equipData: []
    }
  },
  components: {
    AddFrom
  },
  methods: {
    handleSubmit (addForm) {
      // console.log(JSON.stringify(addForm))
      addMeetRoom(addForm).then(res => {
        if (res.data.code === 200) {
          this.$refs.addFrom.success()// 新增成功
          this.$Message.success(res.data.message)
        } else {
          this.$refs.addFrom.fail()
          this.$Message.error(res.data.error)
        }
      }).catch(err => {
        console.log(err)
        this.$refs.addFrom.fail()
        this.$Message.error('创建失败')
      })
    }

  }
}
</script>
